<template>
  <TheContainer :title="title">
    <Table border :columns="columns" :data="data">
      <template slot="action" slot-scope="index">
        <Button
          type="primary"
          size="small"
          @click="show(index.row._id)"
          >详情</Button
        >
      </template>
    </Table>
  </TheContainer>
</template>

<script>
export default {
  data() {
    return {
      title: "用户收藏数据",
      columns: [
        {
          title: "用户名",
          align: "center",
          key: "nickname",
        },
        {
          title: "邮箱",
          align: "center",
          key: "email",
        },
        {
          title: "性别",
          align: "center",
          key: "gender",
        },
        {
          title: "最后修改时间",
          align: "center",
          key: "last_modified_time",
        },
        {
          title: "创建时间",
          align: "center",
          key: "created_time",
        },
        {
          title: "操作",
          slot: "action",
          width: 150,
          align: "center",
        },
      ],
      data: [],
    };
  },
  created() {
    this.getUserList();
  },
  methods: {
    init(id) {
      this.$API
        .POST_FAVORITES_USER({id})
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        })
        .finally(() => {
          console.log(123);
        });
    },
    getUserList() {
      this.$API.GET_ALL_USER(this.form).then((res) => {
        this.data = res.data;
      });
    },
	show(id) {
		this.init(id)
		// console.log(12);
	}
  },
};
</script>

<style>
</style>
